package org.crazyit.activiti_d4._4_GetResourceNames;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;

import java.util.List;

public class GetResourceNames {

    public static void main(String[] args) {

        //1. 创建流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

        //2. 得到流程存储服务对象
        RepositoryService repositoryService = engine.getRepositoryService();

        //3. 部署一份流程文件与相应的流程图文件
        Deployment deploy = repositoryService.createDeployment()
                .addClasspathResource("GetResourceNames.bpmn")
                .addClasspathResource("GetResourceNames.png")
                .deploy();

        //4. 查询资源文件名称集合
        List<String> names = repositoryService.getDeploymentResourceNames(deploy.getId());

        //5. 输出资源文件名集合
        for (String name : names) {
            System.out.println(name);
        }

    }

}
